import React, {useState,useEffect} from 'react';
import { Button, Input, Form} from 'antd';
import Axios from "../../util/axios";
import {inject,observer} from "mobx-react";

function Xgmm(props)  {
    const onFinish = (values) => {
        console.log(values)
        console.log(props.user.user[0].Id)
        Axios.post('/resuser',{
            Pwd:values.pwd,
            Id:props.user.user[0].Id
        }).then((res)=>{
            if(res.data.code===200){
                console.log("成功")
            }else {
                console.log("失败")
            }

        })


    };

    const onFinishFailed = (errorInfo) => {
        console.log('Failed:', errorInfo);
    };
        return (
            <div className={"frmLogin"}>
                <h2>修改密码</h2>
                <Form
                    name="basic"
                    labelCol={{
                        span: 8,
                    }}
                    wrapperCol={{
                        span: 16,
                    }}
                    initialValues={{
                        remember: true,
                    }}
                    onFinish={onFinish}
                    onFinishFailed={onFinishFailed}
                    autoComplete="off"
                >
                    <Form.Item
                        label="密码"
                        name="pwd"
                        rules={[
                            {
                                required: true,
                                message: '请输入密码!',
                            },
                        ]}
                    >
                        <Input />
                    </Form.Item>

                    <Form.Item
                        wrapperCol={{
                            offset: 8,
                            span: 16,
                        }}
                    >
                        <Button className={"Loginbut"} type="primary" htmlType="submit">
                            确认修改
                        </Button>
                    </Form.Item>
                </Form>
            </div>
        );

}

export default inject('user')(observer(Xgmm));